import {createStore, combineReducers} from 'redux'
import {LoadingReducer} from './reducers/LoadingReducer'
import {DataReducer} from './reducers/DataReducer'

import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'

const persistConfig = {
  key: 'wsh3038971',
  storage,
  blacklist: ['LoadingReducer']
}
const reducer = combineReducers({
  LoadingReducer,
  DataReducer
})
// 按照persistConfig配置信息对reducer做持久化处理
const persistedReducer = persistReducer(persistConfig, reducer)

// 通过persistedReducer生成store
let store = createStore(persistedReducer)
// 通过persistStore接收store生成persistor
let persistor = persistStore(store)
// const store = createStore(reducer)

export {store, persistor}